1 <?
2 if
(isset($_POST['butSaveLoai'])) {
3     $donvi = trim($_POST[
'txtName']);
4     $gia = trim($_POST[
'txtGia']);
5
6     
if ($donvi=="")
7     {
8         echo
"<p align=center class='err'>B&#7841;n ch&#432;a nh&#7853;p tên giá</p>";
9     }
10     
else
11     {
12         
if (!empty($_POST['oldid'])) {
13             $oldid = $_POST[
'oldid'];
14             $sql =
"update price set dv_name='".$donvi."',parent_id='".$gia."' where dv_id='".$oldid."'";
15         }
16         
else
17             $sql =
"insert into price (dv_name,dv_dateadded,parent_id) values ('".$donvi."',SYSDATE(),'".$gia."')";
18         
if (mysql_query($sql,$con)) {
19             echo
"<p align=center class='err'>&#272;ã c&#7853;p nh&#7853;t thành công</p><br>";
20             echo
"<script>window.location='index.php?act=price&page=".$_REQUEST['page']."'</script>";
21         }
22         
else echo "<p align=center class='err'>Không th&#7875; c&#7853;p nh&#7853;t</p>";
23     }
24 }
25 ?>
26
27 <?
28     
if (isset($_GET['id'])) {
29         $oldid=$_GET[
'id'];
30         $sql =
"select * from price where dv_id='".$oldid."'";
31         
if ($result = mysql_query($sql,$con)) {
32             $row=mysql_fetch_array($result);
33             $donvi=$row[
'dv_name'];
34             $gia=$row[
'parent_id'];
35
36         }
37     }
38 ?>
39
40 <form method=
"POST" name="FormLoaiSP" action="index.php">
41 <input type=hidden name=
"act" value="price_m">
42 <input type=hidden name=
"oldid" value="<? echo $oldid; ?>">
43 <input type=hidden name=
"page" value="<? echo $_REQUEST['page']; ?>">
44 <table border=
"1" cellpadding="0" cellspacing="0" style="border-collapse: collapse" bordercolor="#0069A8" width="100%" id="AutoNumber1">
45   <tr>
46     <td width=
"45%" align="center" class="title" height="20">Thêm m&#7899;i / C&#7853;p nh&#7853;t :
47     Giá</td>
48   </tr>
49   <tr>
50     <td width=
"45%">
51     <table border=
"0" cellpadding="4" bordercolor="#111111" width="100%" id="AutoNumber2" cellspacing="0">
52       <tr>
53         <td width=
"15%" class="smallfont">
54         <p align=
"right">Tên giá</td>
55         <td width=
"1%" class="smallfont">
56         <font color=
"#FF0000">*</font></td>
57         <td width=
"83%" class="smallfont">
58         <INPUT
value="<? echo $donvi; ?>" TYPE="text" NAME="txtName" CLASS=textbox size="34"></td>
59       </tr>
60       <tr>
61         <td width=
"15%" class="smallfont">
62         <p align=
"right">Giá</td>
63         <td width=
"1%" class="smallfont">
64         <font color=
"#FF0000">*</font></td>
65         <td width=
"83%" class="smallfont">
66         <INPUT
value="<? echo $gia; ?>" TYPE="text" NAME="txtGia" CLASS=textbox size="34"></td>
67       </tr>
68
69       <tr>
70         <td width=
"15%" class="smallfont">
71         <p align=
"right">
72         <INPUT TYPE=
"submit" NAME="butSaveLoai" VALUE="C&#7853;p nh&#7853;t" CLASS=button>&nbsp;</td>
73         <td width=
"1%" class="smallfont">
74         &nbsp;</td>
75         <td width=
"83%" class="smallfont"><p align="left">&nbsp;<INPUT TYPE="reset" CLASS=button value="Nh&#7853;p l&#7841;i"></td>
76       </tr>
77     </table>
78     </td>
79   </tr>
80   </table>
81 </form>



Full source code website bán hàng thương mại điện tử gần giống shopee 468.826 lượt xem

Gõ tìm kiếm nhanh...